/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Data;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author saleem
 */
@Entity
@Table(name = "patientvisit")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Patientvisit.findAll", query = "SELECT p FROM Patientvisit p"),
    @NamedQuery(name = "Patientvisit.findByPid", query = "SELECT p FROM Patientvisit p WHERE p.patientvisitPK.pid = :pid"),
    @NamedQuery(name = "Patientvisit.findByVid", query = "SELECT p FROM Patientvisit p WHERE p.patientvisitPK.vid = :vid"),
    @NamedQuery(name = "Patientvisit.findByVisitDateTime", query = "SELECT p FROM Patientvisit p WHERE p.visitDateTime = :visitDateTime"),
    @NamedQuery(name = "Patientvisit.findByBloodPressureUpper", query = "SELECT p FROM Patientvisit p WHERE p.bloodPressureUpper = :bloodPressureUpper"),
    @NamedQuery(name = "Patientvisit.findByBloodPressureLower", query = "SELECT p FROM Patientvisit p WHERE p.bloodPressureLower = :bloodPressureLower"),
    @NamedQuery(name = "Patientvisit.findByTemperature", query = "SELECT p FROM Patientvisit p WHERE p.temperature = :temperature"),
    @NamedQuery(name = "Patientvisit.findByRespiratoryRate", query = "SELECT p FROM Patientvisit p WHERE p.respiratoryRate = :respiratoryRate"),
    @NamedQuery(name = "Patientvisit.findByPulse", query = "SELECT p FROM Patientvisit p WHERE p.pulse = :pulse")})
public class Patientvisit implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PatientvisitPK patientvisitPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "VisitDateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date visitDateTime;
    @Basic(optional = false)
    @NotNull
    @Column(name = "BloodPressureUpper")
    private int bloodPressureUpper;
    @Basic(optional = false)
    @NotNull
    @Column(name = "BloodPressureLower")
    private int bloodPressureLower;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Temperature")
    private double temperature;
    @Basic(optional = false)
    @NotNull
    @Column(name = "RespiratoryRate")
    private double respiratoryRate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Pulse")
    private double pulse;
    @JoinColumn(name = "HID", referencedColumnName = "HID")
    @ManyToOne(optional = false)
    private Hospital hid;

    public Patientvisit() {
    }

    public Patientvisit(PatientvisitPK patientvisitPK) {
        this.patientvisitPK = patientvisitPK;
    }

    public Patientvisit(PatientvisitPK patientvisitPK, Date visitDateTime, int bloodPressureUpper, int bloodPressureLower, double temperature, double respiratoryRate, double pulse) {
        this.patientvisitPK = patientvisitPK;
        this.visitDateTime = visitDateTime;
        this.bloodPressureUpper = bloodPressureUpper;
        this.bloodPressureLower = bloodPressureLower;
        this.temperature = temperature;
        this.respiratoryRate = respiratoryRate;
        this.pulse = pulse;
    }

    public Patientvisit(double pid, double vid) {
        this.patientvisitPK = new PatientvisitPK(pid, vid);
    }

    public PatientvisitPK getPatientvisitPK() {
        return patientvisitPK;
    }

    public void setPatientvisitPK(PatientvisitPK patientvisitPK) {
        this.patientvisitPK = patientvisitPK;
    }

    public Date getVisitDateTime() {
        return visitDateTime;
    }

    public void setVisitDateTime(Date visitDateTime) {
        this.visitDateTime = visitDateTime;
    }

    public int getBloodPressureUpper() {
        return bloodPressureUpper;
    }

    public void setBloodPressureUpper(int bloodPressureUpper) {
        this.bloodPressureUpper = bloodPressureUpper;
    }

    public int getBloodPressureLower() {
        return bloodPressureLower;
    }

    public void setBloodPressureLower(int bloodPressureLower) {
        this.bloodPressureLower = bloodPressureLower;
    }

    public double getTemperature() {
        return temperature;
    }

    public void setTemperature(double temperature) {
        this.temperature = temperature;
    }

    public double getRespiratoryRate() {
        return respiratoryRate;
    }

    public void setRespiratoryRate(double respiratoryRate) {
        this.respiratoryRate = respiratoryRate;
    }

    public double getPulse() {
        return pulse;
    }

    public void setPulse(double pulse) {
        this.pulse = pulse;
    }

    public Hospital getHid() {
        return hid;
    }

    public void setHid(Hospital hid) {
        this.hid = hid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (patientvisitPK != null ? patientvisitPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Patientvisit)) {
            return false;
        }
        Patientvisit other = (Patientvisit) object;
        if ((this.patientvisitPK == null && other.patientvisitPK != null) || (this.patientvisitPK != null && !this.patientvisitPK.equals(other.patientvisitPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Data.Patientvisit[ patientvisitPK=" + patientvisitPK + " ]";
    }
    
}
